#include "isSubStructure.h"
bool isSameTree(TreeNode* A, TreeNode* B)
{
    if (!B)
        return true;
    else if (!A || A->val != B->val)
        return false;
    else
        return isSameTree(A->left, B->left) && isSameTree(A->right, B->right);
}
bool isSubStructure(TreeNode* A, TreeNode* B)
{
    if (!A || !B)
        return false;
    if (!isSameTree(A, B))
    {
        return isSubStructure(A->left, B) || isSubStructure(A->right, B);
    }
    else
        return true;
}
